package com.boesch.electroOffice.business.businessObject;

import java.util.List;

import com.boesch.electroOffice.business.common.BusinessException;
import com.boesch.electroOffice.dataaccess.common.IllegalDataAccessException;
import com.boesch.electroOffice.model.electroOffice.Appointment;
import com.boesch.electroOffice.model.wrapper.AppointmentWrapper;
import com.liferay.portal.model.User;

/**
 * This interface allocates all methods for AppointmentBusinessObject.
 * The methods are only called by the application layer.
 * If there is an error on executing the method, a illegalBusinessObjectException will be thrown.
 * 
 * @author Ralph Koster
 *
 */
public interface AppointmentBusinessObject {

	/**
	 * Reads all appointments from dataaccess
	 * 
	 * @return List<AppointmentElectroOffice> appointments
	 * @throws IllegalDataAccessException
	 * @throws BusinessException
	 */
	public List<Appointment> readAllAppointmentsFromDataaccess() throws IllegalDataAccessException, BusinessException;

	/**
	 * Reads all appointmentWrapper from dataaccess
	 * 
	 * @return List<AppointmentWrapper> appointmentWrapper
	 * @throws IllegalDataAccessException
	 * @throws BusinessException
	 */
	public List<AppointmentWrapper> readAllAppointmentWrapperFromDataaccess() throws IllegalDataAccessException, BusinessException;

	/**
	 * Reads an appointment by the id
	 * 
	 * @param Integer appointmentId
	 * @return Appointment appointment
	 * @throws IllegalDataAccessException ex
	 * @throws BusinessException ex
	 */
	public Appointment readAppointmentById(Integer appointmentId) throws IllegalDataAccessException, BusinessException;

	public AppointmentWrapper readAppointmentWrapperById(int appointmentId) throws IllegalDataAccessException, BusinessException;

	/**
	 * Saves a new appointment and all its components 
	 * to database
	 * 
	 * @param newAppointment
	 * @return String returnCode
	 * @throws IllegalDataAccessException
	 */
	public String saveAppointment(Appointment appointment, User currentUser) throws IllegalDataAccessException, BusinessException;

	/**
	 * Updates an appointment and all its components on database 
	 * 
	 * @param appointment
	 * @return String returnCode
	 * @throws IllegalDataAccessException
	 */
	public String updateAppointment(Appointment appointment, User currentUser) throws IllegalDataAccessException, BusinessException;

	public String openAppointment(Appointment appointment, User currentUser) throws IllegalDataAccessException, BusinessException;

	public String closeAppointment(Appointment appointment, User currentUser) throws IllegalDataAccessException, BusinessException;

}
